package app.modules.menu.persistence.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jasmine.framework.database.mybatisplus.dao.BaseEntityDAO;
import jasmine.security.rbac.mapper.SecMenuTemplateMapper;
import jasmine.security.rbac.model.SecMenuTemplate;
import org.springframework.stereotype.Repository;

/**
 * @author mh.z
 */
@Repository
public class MenuTemplateDAO extends
        BaseEntityDAO<SecMenuTemplateMapper, SecMenuTemplate> {

    /**
     * 查找指定模板代码的菜单模板
     *
     * @param templateCode
     * @return
     */
    public SecMenuTemplate getByTemplateCode(String templateCode) {
        LambdaQueryWrapper<SecMenuTemplate> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(SecMenuTemplate::getTemplateCode, templateCode);

        return baseMapper.selectOne(wrapper);
    }

}
